<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link href="css/main.css" type="text/css" rel="stylesheet"/>
<style>
	html,.left_main{ overflow:hidden; overflow-y:auto; height:100%;}
</style>
<title>中国人寿管理平台</title>
</head>
<body style="background:#ecf2f8">
<div class="left_main">
</div>
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script>
$(function() {
	/*获取列表信息，生成左侧导航*/
	$.ajax({
		url: 'getLeftMenu.do', 
		type: 'POST',
		async: false,
		dataType: 'json', 
		timeout: 10000, 
		error: function(){showTips('请求失败,请稍后重试');}, 
		success: function(result){
			if(result.resultCode==1000){
				var items=result.returnObject;
				if (items.length > 0) {
					var fnav="",c,fi,bc;
					$.each(items,function(i){
						(i==0) ? c = "show" : c = "";
						(i==0) ? fi = "<i><img src='images/a.png'></i>" : fi = "<i><img src='images/l.png'></i>";
						
						fnav+='<div href="javascript:void(0)" class="nav_left_on"><h3 '+bc+'><em><img src="images/ic.png"></em>'+items[i].MENUNAME+fi+'</h3><ul class="' +c+ '">';
						var childList = items[i].childList;
						$.each(childList,function(k){
							fnav += '<li><a href="'+childList[k].MENUURL.substring(1)+'" target="'+childList[k].URLTARGET+'" class="list_a">'+childList[k].MENUNAME+'</a></li>';
						});
						fnav += '</ul></div>';
					});
					$(".left_main").html(fnav);
				}
			}else if(result.resultCode==1004){
				showTips(result.returnObject);
				top.location.href ="login.jsp";
			}else{
				showTips(result.returnObject);
			}
			
			$(".left_main h3").click(function(){
				var me = $(this);
				$(".left_main ul").hide();
				$(".left_main i").html("<img src='images/l.png'>");
				me.next().show();
				me.css({"border":"none"});
				me.find("i").html("<img src='images/a.png'>");
			});
			$(".left_main a").click(function(){
				$(".left_main a").css({"color":"#767676"});
				$(this).css({"color":"#3e8ed7"});
				$(".left_main a img").remove();
			});
		}
	});
});

function changeMenu(url){
	//alert(url);
	
	$(".left_main").find("a[href='"+url+"']").eq(0).click();
}

</script>
</body>
</html>
